package com.sec.android.app.myfiles.module.local.recent;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.sec.android.app.myfiles.R;
import com.sec.android.app.myfiles.fragment.home.HomeFragment;
import com.sec.android.app.myfiles.fragment.home.HomeFragmentItem;
import com.sec.android.app.myfiles.module.abstraction.FileRecord;
import com.sec.android.app.myfiles.util.PreferenceUtils;
import com.sec.android.app.myfiles.util.UiUtils;

public class LeftPanelRecentHomeItem extends HomeFragmentItem {
    private View mLeftPanelRecentView;
    public LeftPanelRecentHomeItem(Context context, HomeFragment fragment) {
        super(context, fragment);
    }

    @Override
    protected void setListItem() {
        HomeItemInfo item;
        HomeItemClickListener onclick;
        FileRecord record;

        record = UiUtils.getRecentRecord();
        onclick = new HomeItemClickListener(record, null);
        item = new HomeItemInfo(R.id.recent_stub, R.id.home_list_item_recent, R.drawable.my_files_ic_recent_files,
                R.color.home_icon_recent_color, 0, R.string.subtitle_recent, onclick);
        mItemList.add(item);
        mLeftPanelRecentView = item.itemView;
        if (mLeftPanelRecentView != null) {
            TextView sizeView = (TextView) mLeftPanelRecentView.findViewById(R.id.home_list_item_text_second);
            setViewVisibility(sizeView, View.GONE);
        }
    }

    @Override
    protected void _onResume() {
    }

    @Override
    protected void _onDestroy() {
    }

    @Override
    protected void _onPause() {
    }

    public void updateVisibility() {
        if (mLeftPanelRecentView != null) {
            setViewVisibility(mLeftPanelRecentView, PreferenceUtils.getShowRecentFiles(mContext) ? View.VISIBLE : View.GONE);
        }
    }
}
